//
//  BVUserInstructionsViewController.m
//  BuyVegetables1
//
//  Created by zhuzi on 16/8/20.
//  Copyright © 2016年 YSC. All rights reserved
#import "BVUserInstructionsViewController.h"
#import "BVUserMustToKnowViewController.h"
#import "BVReturnInstructionsViewController.h"
#import "BVConst.h"

@interface BVUserInstructionsViewController ()<UITableViewDataSource,UITableViewDelegate>
{

    NSArray * _arry;

}
@end

@implementation BVUserInstructionsViewController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.title = @"用户须知";
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _arry = [[NSArray alloc]initWithObjects:@"精菜网服务协议",@"退换货说明", nil];
    
    UITableView * table = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 64)];
    table.delegate = self;
    table.dataSource = self;
//    table.backgroundColor = [UIColor clearColor];
    table.scrollEnabled = NO;
    table.tableFooterView = [[UIView alloc] init];
    [self.view addSubview:table];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"iden"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"iden"];
    }

    cell.textLabel.text = _arry[indexPath.row];
    cell.textLabel.textColor = BVBaseTextBlackColor;
    cell.textLabel.font = [UIFont systemFontOfSize:16];
    cell.backgroundColor = [UIColor clearColor];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        BVUserMustToKnowViewController * UserMustToKnow = [[BVUserMustToKnowViewController alloc]init];
        [self.navigationController pushViewController:UserMustToKnow animated:YES];
    } else {
    
        BVReturnInstructionsViewController * ReturnInstructions = [[BVReturnInstructionsViewController alloc]init];
        [self.navigationController pushViewController:ReturnInstructions animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
